fn main() {
    println!("Hello, world!");
}

#[derive(Debug)]
pub struct Rectangle {
    width: u32,
    height: u32,
}

impl Rectangle {
    pub fn can_hold(&self, other: &Rectangle) -> bool {
        self.width > other.width && self.height > other.height
    }
}

#[derive(Debug)]
struct Guess {
    value : u32,
}

impl Guess{
    fn new(value : u32) -> Guess {
        if value < 0 || value > 100 {
            panic!("Error ! Values  100".to_string())
        }

        Guess {
            value : value,
        }
    }
}

#[cfg(test)]
mod test{
    use crate::Rectangle;
    use crate::Guess;

    #[test]
    fn exploration(){
        assert_eq!(2 + 2, 4);
    }

    #[test]
    fn another(){
        // panic!("Error");
    }

    #[test]
    fn check_hold(){
        let larger = Rectangle{width: 10 , height :20};
        let smaller = Rectangle{width: 1 , height :2};

        assert!(larger.can_hold(&smaller));
    }

    #[test]
    // #[should_panic]
    #[should_panic(expected = "Value")]
    fn test_guess_new(){
        let guess = Guess::new(101);

        // println!("{:?}",guess);
    }
}